<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // const p1 = new Promise((resolve, reject) => {
      //        setTimeout(() => {
      //          // resolve();
      //          reject(
      //            "NavigationDuplicated: Avoided redundant navigation to current location: '/search'."
      //          );
      //        }, 2000);
      //      })
     
      // function push(location, onComplete, onAbort) {
      //   return new Promise((resolve, reject) => {
      //     setTimeout(() => {
      //       // resolve();
      //       reject(
      //         "NavigationDuplicated: Avoided redundant navigation to current location: '/search'."
      //       );
      //     }, 2000);
      //   })
      //     .then(onComplete)
      //     .catch(onAbort);
      // }

      // function myPush(a, onComplete = () => {}, onAbort = () => {}) {
      //   return push(a, onComplete, onAbort);
      // }

      // myPush("123");
      function push(location,onComplete,onAbort){
        return new Promise((resolve,reject) => {
          setTimeout(() => {
            reject('dfaffafa')
          },2000)
        }).then(onComplete).catch(onAbort)
      }
      function myPush(a,onComplete = () => {},onAbort = () => {}){
        return push(a,onComplete,onAbort)
      }
    </script>
  </body>
</html>
